Recover XA (QxdaXARecover) API


  Required Parameter Group:

1 Connection handle Input Binary(4)
2 Array of transaction branch identifiers Output Array of Char(140)
3 Array entries allocated Input Binary(4)
4 Return value Output Binary(4)
5 Flags Input Binary(4)
6 Error code I/O Void(*)

  Service Program: QXDAEDRS

  Default Public Authority: *USE

  Threadsafe: Conditional; see Usage Notes

A transaction manager calls QxdaXARecover() during recovery to obtain a list of transaction branch identifiers that are currently in a prepared or heuristically completed state. Multiple calls to this function can be made in a single recovery scan. The flags parameter defines when a recovery scan should start or end. The connection does not have to be associated with the transaction in any way.


Authorities and Locks

None.


Required Parameter Group

Connection handle
INPUT; BINARY(4)

The handle number of the connection on which to perform the XA operation. The connection handle must have been generated by the QxdaConnectEDRS API in the current job and activation group.

Array of transaction branch identifiers
OUTPUT; CHAR(*)

An array into which the resource manager places XIDs, each containing a max size of 140 bytes, for transaction branches in prepared or heuristically completed states.

Array entries allocated
INPUT; BINARY(4)

The number of transaction branch identifiers that can be returned into the Array of transaction branch identifiers.

Return value
OUTPUT; BINARY(4)

The return value of the XA operation. Possible return values:

-6 [XAER_PROTO] xa_recover() was not successful. Function was called in an improper context.
-5 [XAER_INVAL] xa_recover() was not successful. Incorrect arguments were specified.
-3 [XAER_RMERR] xa_recover() was not successful. The resource manager detected an error when retrieving the transaction branch.
>=0 The total number of XIDs returned in the xids array.

Flags
INPUT; BINARY(4)

Indicator of how to perform the XA operation. The following are valid settings of flags:

TMSTARTRSCAN: x01000000 Start a recovery scan and position the cursor to the start of the list. Transaction Branch Identifiers are returned from that point.
TMENDRSCAN: x00800000 End a recovery scan after returning the XIDs. If this flag is used with the TMSTARTRSCAN flag, then a single xa_recover() call starts and ends the recovery scan.
TMNOFLAGS: x00000000 Continue a recovery scan. Transaction Branch Identifiers are returned starting at the current cursor position.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.



Usage Notes

This function may be called from the initial thread of a job only.


Error Messages

Message ID Error Message Text
CPE3418 E Possible APAR condition or hardware failure.
CPF3CF2 E Error(s) occurred during running of &1 API.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.
CPFB760 E Error encountered in &2 API, return code &1.

Related Information

The QxdaXA APIs follow the NTS (transactions with transaction scoped locks) model. For more information regarding the NTS model, see XA APIs.

Example

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include qxdaedrs.h 

main()
{ 
err_t     err; 
Qxda_CDBI0100_t *istr = (Qxda_CDBI0100_t *)instruct;
Qxda_CDBO0100_t  ostr;
int ostrsize;
XID xids[10];
Qsq_sqlca_t      myca; 
int   stmt1len = 21;
int flags = TMSTARTRSCAN + TMENDRSCAN; 
int count = 30; 
int ret_val; 




 memset(istr, '\0', sizeof(Qxda_CDBI0100_t));                  


 istr->Connection_Type = 'U';                                                        
 memset(istr->Server_Name, ' ', 256);                  
 istr->Commitment_Control = 'S';                          
 _CPYBYTES(istr->Commit_Scope, "*XA                      ", 10);         
 istr->Allow_Suspend = 'Y';
 memset(istr->RDB_Specified, '0', 1);
 istr->SQLDA_Cache_Size = 10;                             
 istr->Offset_Job_Data = sizeof(Qxda_CDBI0100_t);         
 istr->Length_Job_Data = 7;                               
 _CPYBYTES((char *)istr + istr->Offset_Job_Data, "CONNECT", 7);   
 istr->Offset_Suspend_Data = istr->Offset_Job_Data + istr->Length_Job_Data; 
 istr->Length_Suspend_Data = 7;   
 memset(istr->RDB_Name, ' ', 18);
 _CPYBYTES(istr->TM_Info, "TM_Name         ", 10); 
 istr->LockTimeoutVal = 10;  
 ostrsize = sizeof(Qxda_CDBO0100_t);                                        


 QxdaConnectEDRS(istr, "CDBI0100", &ostr, &ostrsize,
                  "CDBO0100", &err);


 QxdaXARecover(&ostr.Connection_Handle, xids, &count, &ret_val, &flags, &err);

} 

  


API introduced: V5R3

[ Back to top | Database and File APIs | APIs by category ]